#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
const int mod = 10007;
int n, m;
string s;
string str;
bool check[mod + 3];
int hash (string s) {
	long long h = 0;
	for (int i = 0; i < s.size(); i++) {
		h += (s[i] * (i + 1)) % mod;
	}
	return h;
}
int main() {
	scanf ("%d", &n);
	for (int i = 1; i <= n; i++) {
		cin >> s;
		check[hash(s)] = 1;
	}
	scanf ("%d", &m);
	for (int i = 1; i <= m; i++) {
		cin >> str;
		if (check[hash(str)]) {
			printf ("Yes\n");
		} else {
			printf ("No\n");
		}
	}
	return 0;
}